package com.huoshan.im.server.config;

import com.huoshan.im.server.config.properties.SettingConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationContext;

import java.util.List;

/**
 * 说明：作者很懒，什么都没留下
 * Created by 火山九日 on 2020-04-26 14:05
 */
@Slf4j
public class ConfigHolder {

    private static ApplicationContext applicationContext;
    private static SettingConfig settingConfig;
    private static List<String> localHostList;

    public static SettingConfig getSettingConfig() {
        return settingConfig;
    }

    public static void setSettingConfig(SettingConfig settingConfig) {
        ConfigHolder.settingConfig = settingConfig;
    }

    public static ApplicationContext getApplicationContext() {
        return applicationContext;
    }

    public static void setApplicationContext(ApplicationContext applicationContext) {
        ConfigHolder.applicationContext = applicationContext;
    }

    public static <T> T getBean(Class<T> tClass) {
        return applicationContext.getBean(tClass);
    }

    public static Object getBean(String name) {
        return applicationContext.getBean(name);
    }

    public static List<String> getLocalHostList() {
        return localHostList;
    }

    public static void setLocalHostList(List<String> localHostList) {
        ConfigHolder.localHostList = localHostList;
    }

}
